home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Delphi Magazine Collection 2001
/
Delphi Magazine Collection 20001 (2001).iso
/
DISKS
/
Issue34
/
system
/
RichEdit2.pas
< prev
Wrap
Pascal/Delphi Source File
|
1998-05-08
|
3KB
|
112 lines
unit RichEdit2;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ComCtrls, RichEdit;
type
TRichEdit2 = class (TCustomRichEdit)
private
{ Private declarations }
fLibHandle: THandle;
procedure WMNCDestroy (var Message: TWMNCDestroy); message wm_NCDestroy;
protected
{ Protected declarations }
procedure CreateParams (var Params: TCreateParams); override;
public
{ Public declarations }
published
{ Published declarations }
property Align;
property Alignment;
property BorderStyle;
property Color;
property Ctl3D;
property DragCursor;
property DragMode;
property Enabled;
property Font;
property HideSelection;
property HideScrollBars;
property ImeMode;
property ImeName;
property Lines;
property MaxLength;
property ParentColor;
property ParentCtl3D;
property ParentFont;
property ParentShowHint;
property PlainText;
property PopupMenu;
property ReadOnly;
property ScrollBars;
property ShowHint;
property TabOrder;
property TabStop default True;
property Visible;
property WantTabs;
property WantReturns;
property WordWrap;
property OnChange;
property OnDragDrop;
property OnDragOver;
property OnEndDrag;
property OnEnter;
property OnExit;
property OnKeyDown;
property OnKeyPress;
property OnKeyUp;
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
property OnResizeRequest;
property OnSelectionChange;
property OnStartDrag;
property OnProtectChange;
property OnSaveClipboard;
end;
procedure Register;
implementation
{$R *.DCR}
procedure TRichEdit2.CreateParams (var Params: TCreateParams);
const
HideScrollBars: array[Boolean] of Longint = (ES_DISABLENOSCROLL, 0);
HideSelections: array[Boolean] of Longint = (ES_NOHIDESEL, 0);
var
OldError: Longint;
begin
OldError := SetErrorMode (sem_NoOpenFileErrorBox);
fLibHandle := LoadLibrary ('RICHED20.DLL');
SetErrorMode (OldError);
if (fLibHandle > 0) and (fLibHandle < hInstance_Error) then fLibHandle := 0;
inherited CreateParams (Params);
if fLibHandle <> 0 then CreateSubClass (Params, 'RICHEDIT20A')
else CreateSubClass (Params, 'RICHEDIT');
with Params do
begin
Style := Style or HideScrollBars [Inherited HideScrollBars] or HideSelections[HideSelection];
WindowClass.style := WindowClass.style and not (cs_HRedraw or cs_VRedraw);
end;
end;
procedure TRichEdit2.WMNCDestroy (var Message: TWMNCDestroy);
begin
Inherited;
if fLibHandle <> 0 then FreeLibrary (fLibHandle);
end;
procedure Register;
begin
RegisterComponents('XFactor', [TRichEdit2]);
end;
end.